package com.sise.wangzhan.main;

import com.sise.wangzhan.client.XmlClient;
import feign.Feign;
import feign.gson.GsonEncoder;
import feign.jaxb.JAXBContextFactory;
import feign.jaxb.JAXBDecoder;
import feign.jaxb.JAXBEncoder;

/**
 * @Classname XmlMain
 * @Description TODO
 * @Date 2020/4/9 10:42
 * @Created by wangzhan
 */
public class XmlMain {
    public static void main(String[] args) {
        JAXBContextFactory jaxbContextFactory = new JAXBContextFactory.Builder().build();

        XmlClient xmlClient = Feign.builder()
                .encoder(new JAXBEncoder(jaxbContextFactory))
                .decoder(new JAXBDecoder(jaxbContextFactory))
                .target(XmlClient.class, "http://localhost:8080/");

        XmlClient.Stu stu = new XmlClient.Stu();
        stu.sid=901;
        stu.sname = "TOMMY";
        stu.chinese = 89;
        stu.math = 80;
        stu.english = 75;

        XmlClient.Result result = xmlClient.createStu(stu);
        System.out.println(result.message);

    }
}
